#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<stack>
#include<stdlib.h>
#include<vector>
using namespace std;
class Solution {
public:
    int evalRPN(vector<string>& tokens)
    {
        stack<int> st;
        for (auto a : tokens)
        {
            if (a == "+" || a == "-" || a == "*" || a == "/")
            {
                int right = st.top();
                st.pop();
                int left = st.top();
                st.pop();
                int result = 0;
                switch (a[0])
                {
                case '+':
                    result = left + right;
                    break;
                case '-':
                    result = left - right;
                    break;
                case '*':
                    result = left * right;
                    break;
                case '/':
                    result = left / right;
                    break;
                }
                st.push(result);
            }
            else
            {
                st.push(atoi(a.c_str()));
            }
        }
        return st.top();
    }
};